<template>
  <div id="main">
    <h2>课程总结</h2>

    <div class="head">
      <el-button
        v-if="jurisdiction=='授课老师'"
        type="primary"
        style="margin:20px"
        @click="handleOpen('添加课程总结', 1)"
      >添加课程总结</el-button>
      <el-input
        v-model="searchTableInfo"
        placeholder="请输入搜索内容"
        style="width:240px;float: right;margin:20px;"
      />
    </div>
    <div id="table-area">
      <el-table
        v-loading="listLoading"
        :data="list.slice((currentPage - 1) * pagesize, currentPage * pagesize)"
        border
        fit
        highlight-current-row
      >
        <el-table-column
          label="序号"
          type="index"
          align="center"
        >
          <template scope="scope">
            <span>{{ (currentPage - 1) * pagesize + scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="courseSummaryClazzTypeName"
          label="课程类型"
        />
        <el-table-column
          align="center"
          prop="courseSummaryTechnicalTypeName"
          label="技术类别"
        />
        <el-table-column
          align="center"
          prop="courseSummaryTeacherName"
          label="授课教师"
        />
        <el-table-column
          align="center"
          prop="courseSummaryStudentName"
          label="学生姓名"
        />

        <el-table-column
          align="center"
          prop="courseSummaryTeachingSupervisorName"
          label="教学主管"
        />
        <el-table-column
          align="center"
          prop="courseSummaryMedicalDirectorName"
          label="医疗主管"
        />
        <el-table-column
          align="center"
          prop="courseSummaryPostTime"
          label="录入时间"
        />

        <el-table-column
          align="center"
          prop="courseSummaryStatus"
          label="批复状态"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.courseSummaryStatus=='0'">授课老师已发布</span>
            <span v-if="scope.row.courseSummaryStatus=='1'">主责老师已批复</span>
            <span v-if="scope.row.courseSummaryStatus=='2'">教学主管已批复</span>
            <span v-if="scope.row.courseSummaryStatus=='3'">授课老师已阅读</span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="操作"
        >
          <template slot-scope="Scope">
            <el-button
              v-if="jurisdiction == '责任教师' ||
                jurisdiction == '教学主任' ||
                jurisdiction == '授课老师' ||
                jurisdiction == '教学主管' ||
                jurisdiction == '教务主任'"
              type="primary"
              icon="el-icon-edit"
              @click="handleOpen('修改课程总结', 2, Scope.row.courseSummaryId)"
            >编辑</el-button>
            <el-button
              v-if="jurisdiction == '医疗主管'"
              type="primary"
              icon="el-icon-search"
              @click="handleOpen('修改课程总结', 2, Scope.row.courseSummaryId)"
            >查看</el-button>
            <!-- <el-button type="danger" icon="el-icon-delete" @click="handleDelete(Scope.row.plansId) ">删除</el-button> -->
          </template>
        </el-table-column>
      </el-table>

      <div id="pages">
        <el-pagination
          :current-page="currentPage"
          :page-sizes="[5, 10]"
          :page-size="pagesize"
          layout="total, sizes,prev, pager, next"
          :total="list.length"
          prev-text="上一页"
          next-text="下一页"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </div>

    <el-dialog
      title=""
      :close-on-click-modal="false"
      :visible.sync="dialogFormVisible"
      :before-close="handleClose"
    >
      <el-form
        ref="courseSummary"
        :model="courseSummary"
        label-position="top"
        :rules="rules"
      >
        <el-form-item
          prop="courseSummaryStudentId"
          label="学生"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-select
            v-model="courseSummary.courseSummaryStudentId"
            placeholder="请选择"
            filterable
            style="width: 100%;"
          >
            <el-option
              v-for="j in child"
              :key="j.studentId"
              :value="j.studentId"
              :label="j.String"
            />
          </el-select>
        </el-form-item>

        <el-form-item
          prop="courseSummaryClazzId"
          label="班级"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-select
            v-model="courseSummary.courseSummaryClazzId"
            placeholder="请选择"
            filterable
            style="width: 100%;"
          >
            <el-option
              v-for="j in clazz"
              :key="j.classId"
              :value="j.classId"
              :label="j.className"
            />
          </el-select>
        </el-form-item>
        <el-form-item
          prop="courseSummaryTeacherId"
          label="授课老师"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-select
            v-model="courseSummary.courseSummaryTeacherId"
            placeholder="请选择"
            filterable
            style="width: 100%;"
          >
            <el-option
              v-for="j in staffTeacher"
              :key="j.staffId"
              :value="j.staffId"
              :label="j.String"
            />
          </el-select>
        </el-form-item>
        <el-form-item
          prop="courseSummaryTeachingSupervisorId"
          label="教学主管"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-select
            v-model="courseSummary.courseSummaryTeachingSupervisorId"
            placeholder="请选择"
            filterable
            style="width: 100%;"
          >
            <el-option
              v-for="j in staffSupervisor "
              :key="j.staffId"
              :value="j.staffId"
              :label="j.String"
            />
          </el-select>
        </el-form-item>
        <el-form-item
          prop="courseSummaryMedicalDirectorId"
          label="医疗主管"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-select
            v-model="courseSummary.courseSummaryMedicalDirectorId"
            placeholder="请选择"
            filterable
            style="width: 100%;"
          >
            <el-option
              v-for="j in staffMedicalDirector"
              :key="j.staffId"
              :value="j.staffId"
              :label="j.String"
            />
          </el-select>
        </el-form-item>
        <el-form-item
          prop="courseSummaryImplementation"
          label="执行情况"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryImplementation"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
          />

        </el-form-item>
        <el-form-item
          prop="courseSummaryCourseEvaluation"
          label="课程评价"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryCourseEvaluation"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
          />

        </el-form-item>
        <el-form-item
          prop="courseSummaryStudentEvaluation"
          label="学生评价"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryStudentEvaluation"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
          />

        </el-form-item>
        <el-form-item
          v-if="jurisdiction ==='责任教师'"
          prop="courseSummaryReplyPrincipalTeacherContent"
          label="主责老师批复内容"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryReplyPrincipalTeacherContent"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item
          v-if="jurisdiction ==='教学主管'"
          prop="courseSummaryReplyTeachingDirectorContent"
          label="教学主管批复内容"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryReplyTeachingDirectorContent"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item
          v-if="editType==2&&(jurisdiction ==='授课老师'||jurisdiction ==='教学主管')"
          prop="courseSummaryReplyPrincipalTeacherContent"
          label="主责老师批复内容"
          :label-width="formLabelWidth"
        >
          {{ courseSummary.courseSummaryReplyPrincipalTeacherContent }}
        </el-form-item>
        <el-form-item
          v-if="editType==2&&jurisdiction ==='授课老师'||jurisdiction ==='责任教师'"
          prop="courseSummaryReplyTeachingDirectorContent"
          label="教学主管批复内容"
          :label-width="formLabelWidth"
        >
          {{ courseSummary.courseSummaryReplyTeachingDirectorContent }}
        </el-form-item>
      </el-form>

      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          v-if="(editType == 2 && this.jurisdiction ==='授课老师') || this.jurisdiction ==='责任教师'|| this.jurisdiction ==='教学主管'"
          type="primary"
          @click="handleUpdate('courseSummary')"
        >修 改</el-button>
        <el-button
          v-if="editType == 1 && this.jurisdiction == '授课老师'"
          type="primary"
          @click="handleAddUser('courseSummary')"
        >添 加</el-button>
      </div>
    </el-dialog>

    <el-dialog
      v-if="jurisdiction ==='医疗主管'"
      title=""
      :close-on-click-modal="false"
      :visible.sync="dialogFormVisible"
      :before-close="handleClose"
    >
      <el-form
        ref="courseSummary"
        :model="courseSummary"
        label-position="top"
        :rules="rules"
      >
        <el-form-item
          prop="courseSummaryStudentId"
          label="学生"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-tag
            type="info"
            effect="plain"
          >
            {{ courseSummary.courseSummaryStudentName }}
          </el-tag>
        </el-form-item>

        <el-form-item
          prop="courseSummaryClazzId"
          label="班级"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-tag
            type="info"
            effect="plain"
          >
            {{ courseSummary. courseSummaryClazzName }}
          </el-tag>
        </el-form-item>
        <el-form-item
          prop="courseSummaryTeacherId"
          label="授课老师"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-tag
            type="info"
            effect="plain"
          >
            {{ courseSummary.courseSummaryTeacherName }}
          </el-tag>
        </el-form-item>
        <el-form-item
          prop="courseSummaryTeachingSupervisorId"
          label="教学主管"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-tag
            type="info"
            effect="plain"
          >
            {{ courseSummary.courseSummaryTeachingSupervisorName }}
          </el-tag>
        </el-form-item>
        <el-form-item
          prop="courseSummaryMedicalDirectorId"
          label="医疗主管"
          :label-width="formLabelWidth"
        >
          <!-- <el-input v-model="teachTodo.teachingTodoRelatedPersonnel" autocomplete="off" maxlength="20" show-word-limit /> -->
          <el-tag
            type="info"
            effect="plain"
          >
            {{ courseSummary.courseSummaryMedicalDirectorName }}
          </el-tag>

        </el-form-item>
        <el-form-item
          prop="courseSummaryImplementation"
          label="执行情况"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryImplementation"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
            readonly
          />

        </el-form-item>
        <el-form-item
          prop="courseSummaryCourseEvaluation"
          label="课程评价"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryCourseEvaluation"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
            readonly
          />

        </el-form-item>
        <el-form-item
          prop="courseSummaryStudentEvaluation"
          label="学生评价"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryStudentEvaluation"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
            readonly
          />

        </el-form-item>
        <el-form-item
          v-if="jurisdiction ==='责任教师'"
          prop="courseSummaryReplyPrincipalTeacherContent"
          label="主责老师批复内容"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryReplyPrincipalTeacherContent"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item
          v-if="jurisdiction ==='教学主管'"
          prop="courseSummaryReplyTeachingDirectorContent"
          label="教学主管批复内容"
          :label-width="formLabelWidth"
        >
          <el-input
            v-model="courseSummary.courseSummaryReplyTeachingDirectorContent"
            autocomplete="off"
            maxlength="500"
            show-word-limit
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 20 }"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item
          v-if="editType==2&&(jurisdiction ==='授课老师'||jurisdiction ==='教学主管')"
          prop="courseSummaryReplyPrincipalTeacherContent"
          label="主责老师批复内容"
          :label-width="formLabelWidth"
        >
          {{ courseSummary.courseSummaryReplyPrincipalTeacherContent }}
        </el-form-item>
        <el-form-item
          v-if="editType==2&&jurisdiction ==='授课老师'||jurisdiction ==='责任教师'"
          prop="courseSummaryReplyTeachingDirectorContent"
          label="教学主管批复内容"
          :label-width="formLabelWidth"
        >
          {{ courseSummary.courseSummaryReplyTeachingDirectorContent }}
        </el-form-item>
      </el-form>

      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          v-if="(editType == 2 && this.jurisdiction ==='授课老师') || this.jurisdiction ==='责任教师'|| this.jurisdiction ==='教学主管'"
          type="primary"
          @click="handleUpdate('courseSummary')"
        >修 改</el-button>
        <el-button
          v-if="editType == 1 && this.jurisdiction == '授课老师'"
          type="primary"
          @click="handleAddUser('courseSummary')"
        >添 加</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getAll, getAllcourseSummary, getcourseSummarybyId, updatecourseSummaryId, updateStatus, getAllcourseSummaryByDirector, getAllcourseSummaryByMedical, getAllcourseSummaryByprincipal, getAllcourseSummaryAAA, addcourseSummer, replyPrincipalTeacher, replyTeachingDirector } from '@/api/courseSummary'
import { selectStudent } from '@/api/child'
import { selectclazz } from '@/api/teachsummary'
import { selectstaff, getStaffStringD, getStaffStringmedical } from '@/api/staff'
import { selectstaffTeacher, getStaffStringR } from '@/api/staff'
// import { validateChineseName, validatePhoneTwo, validateEMail, checkSpecificKey, validateCharacter, btKeyUp, isInteger } from '@/api/validata'
import store from '@/store/index'
export default {
  data () {
    return {

      jurisdiction: '',
      BB: store.getters.userId,
      newcourse: {
      },
      value: '',
      currentPage: 1, // 默认显示页面为1
      pagesize: 5, //    每页的数据条数
      // list: [],
      tableList: [],
      child: {},
      clazz: {},
      staff: {},
      staffSupervisor: {},
      staffMedicalDirector: {},
      staffTeacher: {},
      searchTableInfo: '',
      courseSummary: {},
      listLoading: false,
      dialogFormVisible: false,
      editType: 1, // 1 添加 2 修改

      formLabelWidth: '200px',
      teacher: '',
      rules: {
        courseSummaryStudentId: [
          { required: true, message: '学生不能为空', trigger: 'blur' }
        ],
        courseSummaryClazzId: [
          { required: true, message: '班级不能为空', trigger: 'blur' }
        ],
        courseSummaryTeacherId: [
          { required: true, message: '授课老师不能为空', trigger: 'blur' }
          // {validator:validateChineseName, trigger: ['blur', 'change']},
        ],
        courseSummaryTeachingSupervisorId: [
          { required: true, message: '教学主管不能为空', trigger: 'blur' }
          // {validator:validateChineseName, trigger: ['blur', 'change']},
        ],
        courseSummaryMedicalDirectorId: [
          { required: true, message: '医疗主管不能为空', trigger: 'blur' }
          // {validator:validateChineseName, trigger: ['blur', 'change']},
        ],
        courseSummaryImplementation: [
          { required: true, message: '执行情况不能为空', trigger: 'blur' }
          //  {validator:validateChineseName, trigger: ['blur', 'change']},
        ],
        courseSummaryCourseEvaluation: [
          { required: true, message: '课程评价不能为空', trigger: 'blur' }

        ],
        courseSummaryStudentEvaluation: [
          { required: true, message: '学生评价不能为空', trigger: 'blur' }
          // {validator:validateChineseName, trigger: ['blur', 'change']},
        ]
        // courseSummaryReplyPrincipalTeacherContent: [
        //   { required: true, message: '主责教师批复内容不能为空', trigger: 'blur' }
        // {validator:validateChineseName, trigger: ['blur', 'change']},
        // ],
        // courseSummaryReplyTeachingDirectorContent: [
        //   { required: true, message: '教学主管批复内容不能为空', trigger: 'blur' }
        // {validator:validateChineseName, trigger: ['blur', 'change']},
        // ]
      }
    }
  },
  computed: {
    // 根据计算属性模糊搜索
    list () {
      const searchTableInfo = this.searchTableInfo
      if (searchTableInfo) {
        // filter() 方法创建一个新的数组，新数组中的元素是通过检查指定数组中符合条件的所有元素。
        // 注意： filter() 不会对空数组进行检测。
        // 注意： filter() 不会改变原始数组。
        return this.tableList.filter(data => {
          // some() 方法用于检测数组中的元素是否满足指定条件;
          // some() 方法会依次执行数组的每个元素：
          // 如果有一个元素满足条件，则表达式返回true , 剩余的元素不会再执行检测;
          // 如果没有满足条件的元素，则返回false。
          // 注意： some() 不会对空数组进行检测。
          // 注意： some() 不会改变原始数组。
          return Object.keys(data).some(key => {
            // indexOf() 返回某个指定的字符在某个字符串中首次出现的位置，如果没有找到就返回-1；
            // 该方法对大小写敏感！所以之前需要toLowerCase()方法将所有查询到内容变为小写。
            return (
              String(data[key])
                .toLowerCase()
                .indexOf(searchTableInfo) > -1
            )
          })
        })
      }
      return this.tableList
    }
  },
  created () {
    this.jurisdiction = store.getters.roles[0]
    this.fetchData()
    this.getinfo()
  },
  methods: {
    formatSex: function (row, column, cellValue) {
      if (cellValue === '1') {
        return '女'
      } else if (cellValue === '0') {
        return '男'
      }
    },

    formatAge: function (row, column, cellValue) {
      if (cellValue === -1) {
        return '未填写'
      } else {
        return cellValue
      }
    },
    // 每页下拉显示数据
    handleSizeChange: function (size) {
      this.pagesize = size
    },
    // 点击第几页
    handleCurrentChange: function (currentPage) {
      this.currentPage = currentPage
    },
    getinfo: function () {
      selectStudent().then((resp) => {
        this.child = resp.data.records
      })
      selectstaff().then((resp) => {
        this.staff = resp.data.records
      })
      selectstaffTeacher().then((resp) => {
        this.staffTeacher = resp.data.records
      })

      getStaffStringR().then((resp) => {
        this.staffResponsibleTeacher = resp.data.records
      })

      getStaffStringmedical().then((resp) => {
        this.staffMedicalDirector = resp.data.records
      })
      getStaffStringD().then((resp) => {
        this.staffSupervisor = resp.data.records
      })
      selectclazz().then((resp) => {
        this.clazz = resp.data.records
      })
    },
    handleClick (row) {

    },
    fetchData () {
      this.tableList = []
      this.listLoading = true
      if (this.jurisdiction === '教学主管') {
        getAllcourseSummaryByDirector(this.BB).then(data => {
          this.newcourse

          for (var i = 0; i < data.data.records.length; i++) {
            this.newcourse.courseSummaryId = data.data.records[i].courseSummaryId // 课程总结id
            this.newcourse.courseSummaryClazzTypeName = data.data.records[i].courseSummaryClazzTypeName // 课程类型
            this.newcourse.courseSummaryTechnicalTypeName = data.data.records[i].courseSummaryTechnicalTypeName // 技术类别
            this.newcourse.courseSummaryTeacherName = data.data.records[i].courseSummaryTeacherName // 授课教师
            this.newcourse.courseSummaryStudentName = data.data.records[i].courseSummaryStudentName // 学生姓名
            this.newcourse.courseSummaryTeachingSupervisorName = data.data.records[i].courseSummaryTeachingSupervisorName // 教学主管
            this.newcourse.courseSummaryMedicalDirectorName = data.data.records[i].courseSummaryMedicalDirectorName // 医疗主管
            this.newcourse.courseSummaryPostTime = data.data.records[i].courseSummaryPostTime // 录入时间
            this.newcourse.courseSummaryStatus = data.data.records[i].courseSummaryStatus
            this.tableList.push(this.newcourse)
            this.newcourse = {}
          }
          this.listLoading = false
        })
      } else if (this.jurisdiction === '教学主任') {
        getAllcourseSummaryAAA(this.BB).then(data => {
          this.newcourse
          for (var i = 0; i < data.data.records.length; i++) {
            this.newcourse.courseSummaryId = data.data.records[i].courseSummaryId // 课程总结id
            this.newcourse.courseSummaryClazzTypeName = data.data.records[i].courseSummaryClazzTypeName // 课程类型
            this.newcourse.courseSummaryTechnicalTypeName = data.data.records[i].courseSummaryTechnicalTypeName // 技术类别
            this.newcourse.courseSummaryTeacherName = data.data.records[i].courseSummaryTeacherName // 授课教师
            this.newcourse.courseSummaryStudentName = data.data.records[i].courseSummaryStudentName // 学生姓名
            this.newcourse.courseSummaryTeachingSupervisorName = data.data.records[i].courseSummaryTeachingSupervisorName // 教学主管
            this.newcourse.courseSummaryMedicalDirectorName = data.data.records[i].courseSummaryMedicalDirectorName // 医疗主管
            this.newcourse.courseSummaryPostTime = data.data.records[i].courseSummaryPostTime // 录入时间
            this.newcourse.courseSummaryStatus = data.data.records[i].courseSummaryStatus
            this.tableList.push(this.newcourse)
            this.newcourse = {}
          }

          this.listLoading = false
        })
      } else if (this.jurisdiction === '责任教师') {
        getAllcourseSummaryByprincipal(this.BB).then(data => {
          this.newcourse
          for (var i = 0; i < data.data.records.length; i++) {
            this.newcourse.courseSummaryId = data.data.records[i].courseSummaryId // 课程总结id
            this.newcourse.courseSummaryClazzTypeName = data.data.records[i].courseSummaryClazzTypeName // 课程类型
            this.newcourse.courseSummaryTechnicalTypeName = data.data.records[i].courseSummaryTechnicalTypeName // 技术类别
            this.newcourse.courseSummaryTeacherName = data.data.records[i].courseSummaryTeacherName // 授课教师
            this.newcourse.courseSummaryStudentName = data.data.records[i].courseSummaryStudentName // 学生姓名
            this.newcourse.courseSummaryTeachingSupervisorName = data.data.records[i].courseSummaryTeachingSupervisorName // 教学主管
            this.newcourse.courseSummaryMedicalDirectorName = data.data.records[i].courseSummaryMedicalDirectorName // 医疗主管
            this.newcourse.courseSummaryPostTime = data.data.records[i].courseSummaryPostTime // 录入时间
            this.newcourse.courseSummaryStatus = data.data.records[i].courseSummaryStatus
            this.tableList.push(this.newcourse)
            this.newcourse = {}
          }

          this.listLoading = false
        })
      } else if (this.jurisdiction === '医疗主管') {
        getAllcourseSummaryByMedical(this.BB).then(data => {
          this.newcourse
          for (var i = 0; i < data.data.records.length; i++) {
            this.newcourse.courseSummaryId = data.data.records[i].courseSummaryId // 课程总结id
            this.newcourse.courseSummaryClazzTypeName = data.data.records[i].courseSummaryClazzTypeName // 课程类型
            this.newcourse.courseSummaryTechnicalTypeName = data.data.records[i].courseSummaryTechnicalTypeName // 技术类别
            this.newcourse.courseSummaryTeacherName = data.data.records[i].courseSummaryTeacherName // 授课教师
            this.newcourse.courseSummaryStudentName = data.data.records[i].courseSummaryStudentName // 学生姓名
            this.newcourse.courseSummaryTeachingSupervisorName = data.data.records[i].courseSummaryTeachingSupervisorName // 教学主管
            this.newcourse.courseSummaryMedicalDirectorName = data.data.records[i].courseSummaryMedicalDirectorName // 医疗主管
            this.newcourse.courseSummaryPostTime = data.data.records[i].courseSummaryPostTime // 录入时间
            this.newcourse.courseSummaryStatus = data.data.records[i].courseSummaryStatus
            this.tableList.push(this.newcourse)
            this.newcourse = {}
          }

          this.listLoading = false
        })
      } else if (this.jurisdiction === '教务主任') {
        getAll().then(data => {
          this.newcourse
          for (var i = 0; i < data.data.records.length; i++) {
            this.newcourse.courseSummaryId = data.data.records[i].courseSummaryId // 课程总结id
            this.newcourse.courseSummaryClazzTypeName = data.data.records[i].courseSummaryClazzTypeName // 课程类型
            this.newcourse.courseSummaryTechnicalTypeName = data.data.records[i].courseSummaryTechnicalTypeName // 技术类别
            this.newcourse.courseSummaryTeacherName = data.data.records[i].courseSummaryTeacherName // 授课教师
            this.newcourse.courseSummaryStudentName = data.data.records[i].courseSummaryStudentName // 学生姓名
            this.newcourse.courseSummaryTeachingSupervisorName = data.data.records[i].courseSummaryTeachingSupervisorName // 教学主管
            this.newcourse.courseSummaryMedicalDirectorName = data.data.records[i].courseSummaryMedicalDirectorName // 医疗主管
            this.newcourse.courseSummaryPostTime = data.data.records[i].courseSummaryPostTime // 录入时间
            this.newcourse.courseSummaryStatus = data.data.records[i].courseSummaryStatus
            this.tableList.push(this.newcourse)
            this.newcourse = {}
          }

          this.listLoading = false
        })
      } else {
        getAllcourseSummary(this.BB).then(data => {
          this.newcourse
          for (var i = 0; i < data.data.records.length; i++) {
            this.newcourse.courseSummaryId = data.data.records[i].courseSummaryId // 课程总结id
            this.newcourse.courseSummaryClazzTypeName = data.data.records[i].courseSummaryClazzTypeName // 课程类型
            this.newcourse.courseSummaryTechnicalTypeName = data.data.records[i].courseSummaryTechnicalTypeName // 技术类别
            this.newcourse.courseSummaryTeacherName = data.data.records[i].courseSummaryTeacherName // 授课教师
            this.newcourse.courseSummaryStudentName = data.data.records[i].courseSummaryStudentName // 学生姓名
            this.newcourse.courseSummaryTeachingSupervisorName = data.data.records[i].courseSummaryTeachingSupervisorName // 教学主管
            this.newcourse.courseSummaryMedicalDirectorName = data.data.records[i].courseSummaryMedicalDirectorName // 医疗主管
            this.newcourse.courseSummaryPostTime = data.data.records[i].courseSummaryPostTime // 录入时间
            this.newcourse.courseSummaryStatus = data.data.records[i].courseSummaryStatus
            this.tableList.push(this.newcourse)
            this.newcourse = {}
          }

          this.listLoading = false
        })
      }
    },
    // handleDelete(id) {
    //   this.$confirm('确认删除该记录？').then(() =>
    //     deleteplans(id).then(data => {
    //       this.$notify({
    //         title: '操作成功',
    //         type: 'success'
    //       })
    //       const totalPage = Math.ceil(
    //         (this.tableList.length - 1) / this.pagesize
    //       )
    //       const page =
    //         this.currentPage > totalPage ? totalPage : this.currentPage
    //       this.currentPage = this.currentPage < 1 ? 1 : page
    //       this.fetchData()
    //     })
    //   )
    // },
    handleAddUser (formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          addcourseSummer(this.courseSummary, this.BB).then(resp => {
            this.$notify({
              title: '操作成功',
              type: 'success'
            })
            this.fetchData()
          })
          this.courseSummary = {}
          this.dialogFormVisible = false
          return true
        } else {
          this.$notify({
            title: '请正确填写',
            type: 'error'
          })
          return false
        }
      })
    },

    handleOpen (title, type, id) {
      this.plans = {}
      this.title = title
      this.editType = type

      if (type === 2) {
        getcourseSummarybyId(id).then((resp) => {
          this.courseSummary = resp.data.records
          if (this.jurisdiction === '授课老师') {
            if (this.courseSummary.courseSummaryStatus === 2) {
              updateStatus(this.courseSummary).then(resp => {
                this.fetchData()
              })
            }
          }
        })
        this.dialogFormVisible = true
      } else {
        this.dialogFormVisible = true
      }
    },

    handleClose () {
      this.dialogFormVisible = false
      this.courseSummary = {}
    },
    handleUpdate (formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          if (this.jurisdiction === '责任教师') {
            if (this.courseSummary.courseSummaryStatus === 0) {
              replyPrincipalTeacher(this.courseSummary).then(resp => {
                this.$notify({
                  title: '修改成功',
                  type: 'success'
                })
                this.fetchData()
              })
            } else {
              this.$notify({
                title: '已批复',
                type: 'warning'
              })
            }
          }
          if (this.jurisdiction === '教学主管') {
            if (this.courseSummary.courseSummaryStatus === 1) {
              replyTeachingDirector(this.courseSummary).then(resp => {
                this.$notify({
                  title: '修改成功',
                  type: 'success'
                })
                this.fetchData()
              })
            } else if (this.courseSummary.courseSummaryStatus === 0) {
              this.$notify({
                title: '需责任教师先批复',
                type: 'warning'
              })
            } else {
              this.$notify({
                title: '已批复',
                type: 'warning'
              })
            }
          }
          if (this.jurisdiction === '授课老师') {
            updatecourseSummaryId(this.courseSummary).then(resp => {
              this.$notify({
                title: '修改成功',
                type: 'success'
              })
              this.courseSummary = []
              this.fetchData()
            })
          }
          this.dialogFormVisible = false
          return true
        } else {
          this.$notify({
            title: '请正确填写',
            type: 'error'
          })
          return false
        }
      })
    }

    // getAllJurisdiction() {
    //   getAllJurisdiction().then((resp) => {
    //     this.jurisdiction = resp.obj
    //   })
    // },
  }
}
</script>
np
<style scoped>
#main {
  margin-left: 5px;
  margin-right: 5px;
}
#table-area {
  margin-left: 10px;
  margin-right: 10px;
}
</style>
